package model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wrh on 17-8-15.
 * 图像二次处理后像下层传递块列表类
 * 包含图像块列表和文字块列表
 */

public class Blocks {

    private int docImgWidth;
    private int docImgHeight;

    private List<ImageBlock> imageBlocks;
    private List<TextBlock> textBlocks;


    public Blocks(){
        imageBlocks = new ArrayList<ImageBlock>();
        textBlocks = new ArrayList<TextBlock>();
    }

    public Blocks(List<ImageBlock> imageBlocks, List<TextBlock> textBlocks) {
        if (imageBlocks!=null){
            this.imageBlocks = imageBlocks;
        }else {
            this.imageBlocks = new ArrayList<ImageBlock>();
        }

        if (textBlocks!=null){
            this.textBlocks = textBlocks;
        }else {
            this.textBlocks = new ArrayList<TextBlock>();
        }

    }

    public Blocks addImageBlock(ImageBlock imageBlock){
        imageBlocks.add(imageBlock);
        return this;
    }

    public Blocks addTextBlock(TextBlock textBlock){
        textBlocks.add(textBlock);
        return this;
    }

    public Blocks addImageBlocks(List<ImageBlock> imageBlocks){
        for (ImageBlock imageBlock :imageBlocks) {
            this.imageBlocks.add(imageBlock);
        }
        return this;
    }

    public Blocks addTextBlocks(List<TextBlock> textBlocks){
        for (TextBlock textBlock :textBlocks) {
            this.textBlocks.add(textBlock);
        }
        return this;
    }

    public List<ImageBlock> getImageBlocks() {
        return imageBlocks;
    }

    public List<TextBlock> getTextBlocks() {
        return textBlocks;
    }

    public int getDocImgWidth() {
        return docImgWidth;
    }

    public void setDocImgWidth(int docImgWidth) {
        this.docImgWidth = docImgWidth;
    }

    public int getDocImgHeight() {
        return docImgHeight;
    }

    public void setDocImgHeight(int docImgHeight) {
        this.docImgHeight = docImgHeight;
    }
}
